﻿@using UcAsp.Net.Model;
@using UcAsp.Net.BLL;
@using Config = UcAsp.Net.BLL.SettingConfig;
@using Clear = UcAsp.Net.BLL.ClearCodeBLL;
@using UcAsp.Net.Comm
@{
    Layout = "~/themes/default/Shared/_Layout.cshtml";
}
@model UcAsp.Net.Model.ArticlesPage
@{
    ViewBag.Title = Model.Title;
}
<div class="container-fluid headerpath">
    @(new HtmlString(Categorie.MenuPath(Model.CategoriesID)))
</div>
<div class="container-fluid">
    <div class="row">
        <div class="col-lg-8 col-md-12 col-xs-12">
            <section>
                <header>
                    <h2 id="arttitle">@Model.Title</h2>
                </header>
                <article>
                    @if (!string.IsNullOrEmpty(Model.IconUrl))
                    {
                        <img id="articonurl" src="@Model.IconUrl" /> <br />
                    }
                    <div id="artcontent">
                        @(new HtmlString(Clear.ClearCode(Model.ArticlesContent)))
                    </div>
                </article>
                <footer>
                    @for (int i = 1; i < int.Parse(@ViewData["Count"].ToString()) + 1; i++)
                    {
                        if (i == 1)
                        {
                        <a class="btn btn-info jpage" onclick="return false;"  data-id="@Model.ArticlesID" data-page="@i"  href="/@ViewData["categorieshowpath"]/@(Utils.GetPagePath(ViewData["showpath"].ToString(), Model.ArticlesID)).shtml">@i</a>
                        }
                        else
                        {
                        <a class="btn btn-info jpage" onclick="return false;"  data-id="@Model.ArticlesID" data-page="@i"  href="/@ViewData["categorieshowpath"]/@(Utils.GetPagePath(ViewData["showpath"].ToString(), Model.ArticlesID))_@(i).shtml">@i</a>
                        }
                    }
                </footer>
            </section>
        </div>
        <div class="col-lg-4 col-md-12 col-xs-12">
        </div>
    </div>
</div>

<div class="row-fluid">
    <div class="span8">
        @{
            foreach (UcAsp.Net.Model.Subjects model in UcAsp.Net.BLL.SubjectsConfig.GetMessageSubjects(Model.CategoriesID, Config.Theme(Request.UserAgent)))
            {
                    
            <div class="span6" style="float: left; margin: 0px; padding: 0px;">
                <div>@SubjectsConfig.GetMessageSubjects(model.SubjectId, Model.CategoriesID, Config.Theme(Request.UserAgent)).SubjectName</div>
                @foreach (ArticelsViews art in ArticlesBLL.GetMessageSubject(model.SubjectId, Model.CategoriesID, Config.Theme(Request.UserAgent)))
                {
                    <a href="/@art.CagegorieShowPath/@(Utils.GetPagePath(art.ShowPath, art.ID)).shtml">
                        @(UcAsp.Net.Comm.Utils.ClearPart(art.Title, 20))
                    </a>
                }
            </div>
            }
        }
    </div>
    <div class="span4">
        @(new HtmlString(AdvConfig.GetAdvMessagePositions("AD4", Model.ArticlesID.ToString(), Config.Theme(Request.UserAgent)).AdvHtml))
    </div>
</div>
@{
    List<ArticelsViews> list = (List<ArticelsViews>)ViewData["NextOrPrev"];
    if (list != null)
    {
        ArticelsViews Prev = list[0];
        ArticelsViews Next = list[1];
        if (Prev != null)
        { 
    <a class="btn btn-info" href="/@ViewData["categorieshowpath"]/@(Utils.GetPagePath(Prev.ShowPath, Prev.ID)).shtml">@Prev.Title</a>
        }
        if (Next != null)
        { 
    <a class="btn btn-info" href="/@ViewData["categorieshowpath"]/@(Utils.GetPagePath(Next.ShowPath, Next.ID)).shtml">@Next.Title</a>
        }
    }
}
@section javascript{
    <script>
        $(function () {
            $(".jpage").click(function () {
                $.get("/ShowMessage/PageShowJson?id=" + $(this).attr("data-id") + "&pageindex=" + $(this).attr("data-page"), function (dataResult) {
                    $("#arttitle").html(dataResult.Title);
                    $("#articonurl").attr('src', dataResult.IconUrl);
                    $("#artcontent").html(dataResult.ArticlesContent);
                });
            });
        });

    </script>
}